#ifndef IMCPCAPABILITY_H
#define IMCPCAPABILITY_H

#include <QString>
#include <QJsonObject>
#include <QJsonArray>

#include "CapabilityMethod.h"

/**
 * @brief Interface for MCP capability management
 * 
 * Defines the common interface for all MCP capability types (tools, resources, prompts and more in future).
 * Each capability type must implement this interface with type-specific behavior.
 */
class IMcpCapability
{
public:
    virtual ~IMcpCapability() = default;

    /**
     * @brief Get the capability type prefix
     * @return QString - the prefix string ("tools", "resources", "prompts")
     */
    virtual QString prefix() const = 0;

    /**
     * @brief Get the capability description
     * @return QJsonObject - JSON object containing capability metadata
     */
    virtual QJsonObject capability() const = 0;

    /**
     * @brief Set the capability description
     * @param capability - JSON string containing capability metadata
     * @param enable - Whether to enable the capability (default: true)
     */
    virtual void setCapability(const QString& capability, const bool enable = true) = 0;

    /**
     * @brief List available items for this capability type
     * @return QJsonArray - array of available items
     */
    virtual QJsonArray list() const = 0;

    /**
     * @brief Add a method configuration
     * @param method - a struct containing method describe and it's task
     * @return bool - true if method was added successfully, false otherwise
     */
    virtual bool addMethod(const CapabilityMethod& method) = 0;

    /**
     * @brief Clear the current method configuration
     */
    virtual void clearMethod() = 0;

    /**
     * @brief Execute a method from request. Do not check ID is existed.
     * @param request - JSON object containing method configuration
     * @return QJsonObject - response containing result or error
     */
    virtual QJsonObject doRequest(const QJsonObject& request) = 0;

};

#endif // IMCPCAPABILITY_H
